package save;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import world.Chunk;
import world.SaveWorldInterface;
import world.World;

/*
 * things to save
 * world-section-chunk
 * 
 * chunk
 * 
 * block type 
 * on/off
 * xml
 * 
 * <world id="1">
 * 
 * <section xPos="" yPos="" zPos="">
 * <slice xPos="" yPos="" zPos="">
 * 
 * <chunk xPos="aNumber" yPos="aNumber" zPos="aNumber">
 * 
 * <block type="dirt" state="off"/>
 * 
 * </chunk>
 * 
 * </slice>
 * </section>
 * </world>
 * 
 * 
 */


public class Save implements SaveWorldInterface{
public Save()
{
	
	// SaveWorld constructor
}


public void saveWorld(World world,String worldName, int worldNum)
{
	DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
	DocumentBuilder builder = null;
	
	try {
		builder = builderFactory.newDocumentBuilder();
		
	} catch (ParserConfigurationException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
	
	// Saves the world passed to this method to files.
}

public World loadWorld(int worldNum)
{
	World world = new World();
	
	
	return world;
	//loads the world requested
}


public void saveChunk(Chunk chunk,int worldNum, int chunkNum)
{

	
//saves a single chunk	
}

public Chunk loadChunk(int worldNum,int chunkNum)
{
	Chunk rChunk = new Chunk();
	return rChunk;
//will return a requested chunk	
}



}
